
import 'package:flutter/material.dart';

import 'Language.dart';

class Localization extends InheritedWidget {
	final Language language;
	final Widget child;

  const Localization({Key key, @required this.language, @required this.child}) : super(key: key);

  @override
  Widget build(BuildContext context) => Directionality(
		child: child,
		textDirection: language.textDirection
	);

  static Localization of(BuildContext context) {
  	var me = context.inheritFromWidgetOfExactType(Localization) as Localization;
  	return me;
	}

  @override
  bool updateShouldNotify(InheritedWidget oldWidget) => true;
}

